aiVoice PBX - a complete phone system in one file, set up by chatting
==================================================================

WHAT IT IS
  aivoice-pbx.js is a real SIP phone system (PBX). Real softphones (MicroSIP, Zoiper,
  Linphone, a desk IP phone) register to it and make calls. You configure it by
  typing plain English in a chat window, e.g. "add an extension for Priya".

HOW TO RUN (Windows)
  1. Install Node.js (LTS) from https://nodejs.org if you don't have it.
  2. Double-click start.bat.
  3. If Windows Firewall asks, click "Allow access" (phones need to reach it).
  4. The chat and live switchboard open at http://localhost:8080 (or the next free port).
  Stop it with Ctrl+C in the black window. Settings, voicemail and recordings live
  in the "pbx-data" folder next to aivoice-pbx.js.

HOW TO RUN (Linux, Raspberry Pi, a VPS) - one file does everything
  Copy aivoice-pbx-linux.sh to the Linux machine and run:
      sudo bash aivoice-pbx-linux.sh
  It installs Node.js if needed, a voice for the prompts (espeak-ng), opens the
  firewall, and runs aiVoice PBX as a service that starts again after every reboot.
  At the end it prints the chat page address with its admin password, and the
  phone logins. Run the same file again later to update (settings are kept).
      sudo bash aivoice-pbx-linux.sh --local-only   chat page only on that machine
      sudo bash aivoice-pbx-linux.sh uninstall      remove (add --purge to delete data too)
  Don't open/save the .sh file in Windows Notepad before copying it - that can
  change its line endings and break it. Copy it as it is (USB stick, scp, WinSCP).

CONNECT A SOFTPHONE (e.g. MicroSIP on your phone or another PC on the same Wi-Fi)
  Server / domain : your PC's IP address (shown in the chat and the console)
  Username        : the extension number, e.g. 101
  Password        : ask in the chat: "what is the password for 101"
  Transport       : UDP, port 5060
  Two extensions (101 Alice, 102 Bob) exist from the start. Dial 102 from 101.

CHANGING THE SERVER IP
  aiVoice PBX picks your PC's network address by itself (it prefers your normal Wi-Fi or
  Ethernet address and skips VPN/virtual adapters). To see or change it, type in the chat:
    show IP addresses            - lists every address on this PC and which one is used
    use IP 192.168.1.25          - phones must use this address (must be one of this PC's)
    use the Wi-Fi address        - or "switch to ethernet"
    use automatic IP             - go back to picking it by itself
  The change works straight away; update the server address in each softphone afterwards.
  Your choice is remembered. If that address disappears later (new router, new network),
  aiVoice PBX falls back to automatic and says so in the log.
  For callers from the internet, set your router's public address with
  "set public IP to 203.0.113.5" (this is separate from the address above).

WHAT IT CAN DO
  Extensions, call waiting, hold with music, blind + attended transfer, call forward
  (always / busy / no answer / offline), do-not-disturb, voicemail with message-waiting
  light, voice menus (IVR), ring groups, call queues, conference rooms with PINs,
  call recording, echo test, text messages between phones, an outside-line (SIP trunk),
  call log, live SIP message view, undo.

THINGS YOU CAN TYPE (any wording works - these are just examples)
  add extension 103 for Carol
  create ring group 600 called Sales with 101 102 103
  make a menu on 500: press 1 for sales, 2 for Bob, 0 for voicemail of 101
  forward 102 to 103 when busy
  turn on do not disturb for Bob
  conference room 800 with pin 1234
  record all calls of 101
  set voicemail pin for 101 to 2468
  connect trunk sip.provider.com user 12345 password secret
  show everything      /  undo  /  help

FEATURE CODES (dial from a phone)
  *97 my voicemail     *98 any voicemail box     *43 echo test
  *78 / *79 do-not-disturb on / off              *72<number> forward all   *73 cancel forward
  *65 hear my extension number

CLAUDE MODE (optional)
  Type "use Claude with key sk-ant-..." to let Claude understand messages. The key is
  stored only in pbx-data\config.json on this PC. If Claude is unreachable, the
  built-in English parser answers instead. "turn off Claude" switches back.

LIMITS
  UDP only (no TCP/TLS/SRTP), G.711 audio only (PCMU/PCMA - every softphone supports it),
  voice prompts use Windows' built-in speech. Meant for a home or office LAN, not the
  open internet. The admin page only opens on this PC unless you allow remote access
  with a password in the chat.
